#if !defined(EA_D64BFE93_76BB_4940_A05A_1194AE8FB3A3__INCLUDED_)
#define EA_D64BFE93_76BB_4940_A05A_1194AE8FB3A3__INCLUDED_

#include "Type.h"
#include "Exceptions.h"
#include "Date.h"

#include <string>
#include <iostream>

using namespace std;

class Item {
public:
	Item() {}
	Item(string _itemName, string _owner, Type _itemType, Date _age, float _price) :
			itemName(_itemName), owner(_owner), itemType(
					_itemType), age(_age),last_operation(_age), price(_price) {
		lastItemID++;
		itemID = lastItemID;
	}
	Item(string _itemName, string _owner, Type _itemType, Date _age,Date _last_operation, float _price) :
				itemName(_itemName), owner(_owner), itemType(
						_itemType), age(_age),last_operation(_last_operation), price(_price) {
			lastItemID++;
			itemID = lastItemID;
		}
	virtual ~Item() {}

	/** Obtains the item's name.
	 * @return the name of the item */
	string getName() const {
		return itemName;
	}
	/** Obtains the item's ID.
	* @return the ID of the item */
	unsigned int getID() const {
		return itemID;
	}
	/** Obtains the item's type.
	 * @return the type of the item */
	Type getItemType() const {
		return itemType;
	}
	/** Obtains the item's owner.
	 * @return the ID of the owner of the item */
	string getOwner() const {
		return owner;
	}

	/** Obtains the item's price.
	 * @return the price of the item */
	float getPrice() const {
		return price;
	}

	/** Obtains the item's age.
	 * @return the data of the item's crafting */
	Date getAge() const {
		return age;
	}

	/** Obtains the date of the last operation made on the item.
	 * @return last_operation */
	Date getLastOp() const {
		return last_operation;
	}

	/** Obtains the item's quantity.
	* @return the existent quantity of the item */
	int getQuantity() const
	{
		return quantity;
	}

	unsigned int getLastID() const { return lastItemID; }

	/** Sets itemName equal to _itemName */
	void setName(string _itemName) {
		itemName = _itemName;
	}

	/** Sets itemID equal to _itemID */
	void setID(unsigned int _itemID) {
		itemID = _itemID;
	}

	/** Sets itemType equal to _itemType */
	void setItemType(Type _itemType) {
		itemType = _itemType;
	}

	/** Sets owner equal to _owner */
	void setOwner(string _owner) {
		this->owner = _owner;
	}

	/** Sets price equal to _price */
	void setPrice(float _price) {
		this->price = _price;
	}

	/** Sets age equal to _age */
	void setAge(Date _age) {
		this->age = _age;
	}

	/** Sets last_operation equal to _last_op */
	void setLastOp(Date _last_op) {
		this->last_operation = _last_op;
	}

	/** Sets quantity equal to _quantity */
	void setQuantity(int _quantity)
	{
		this->quantity = _quantity;
	}

	/**
	 * Function that updates the price of the item according to its rarity and quantity
	 * @param quant the quantity of items with the same name and Type
	 */
	void updatePrice(int quant);

	/**
	 * operator == overload to compare the item's name, Type and owner with item2's name, Type and owner
	 */
	bool operator==(const Item & item2) const;

	/**
	 * operator < overload to compare the item's age, name and Type with item2's age, name and Type
	 */
	bool operator< (const Item & item2) const;

	/** shows the information about the item */
	void showItem() const;

private:
	static unsigned int lastItemID;
	unsigned int itemID;
	string itemName;
	string owner;
	Type itemType;
	Date age; //date that it was made
	Date last_operation;
	float price;
	int quantity; // quantity of equal items (items with the same name and type)
	//relating to hash
};
#endif // !defined(EA_D64BFE93_76BB_4940_A05A_1194AE8FB3A3__INCLUDED_)
